#include<stdio.h>
int Add(int n){
    int sum = 0;
    while(n > 0){
        sum += n % 10;
        n = n / 10;
    }
    return sum;
}
int Product(int n){
    int sum = 1;//sum只能初始化为1，为0的话一直都是0了
    while(n > 0){
        sum *= n % 10;
        n = n / 10;
    }
    return sum;
}
int subtractProductAndSum(int n){
    int sum = Add(n);
    int product = Product(n);
    return product - sum;
}
int main(){
    printf("%d", subtractProductAndSum(234));

    return 0;
}